#{extends 'main.html' /}

#{set 'moreStyles'}
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/messageboard.scss'}">
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/Users/edit.scss'}" />
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/navigationbar.scss'}" />
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/Users/commodity.scss'}" />
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/pager/Pager.css'}" />
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/Users/order.scss'}" />
#{/set}

<script src="@{'/public/pager/jquery.pager.js'}" type="text/javascript" charset="utf-8"></script>

<script language="javascript">
	var isSaveSucc = "#{error 'SUCCESS'/}"; 
	//把用户中心设置为选中状态
	$(function(){
		$(".categorynav ul li").removeClass("active");
		$("#message_item").addClass("active");
		if(isSaveSucc == "SUCCESS") {
			alert("您的咨询请求已成功发送，请耐心等候工作人员的审核与答复！");
		}
	});
	$(function(){
		//初始化翻页控件。
		$("#pager").pager(
			{
				pagenumber: ${queryBean.currentPage}, 
				pagecount: ${queryBean.totalPage}, 
				totalcount: ${queryBean.totalQuantity},
				buttonClickCallback: PageClick 
			}
		);
	});
	//翻页功能。
	PageClick = function(pageclickednumber) {
		$("#currentPage").val(pageclickednumber);
		doSearch();
	}

	function doSearch() {
		$("#form2").submit();
	}
</script>

<div class="messageBoard" id="right">
<div class="messageHeader">
   	网友留言
</div>
<div class="box">
	#{if msgs}
			#{list items:msgs, as:'msg'}
				<div class="messageList">
					<span class="messageContent">
						网友：${msg.author}<br>
						<span>
						[问题]
						${msg.title}
						</span>
					</span>
					<div class="reback">
						<p>${msg.content}</p>
					</div>
	      		</div>
	      		
	      		#{if msg.replys}	
	      			#{list items:msg.replys, as:'reply'}
		      			<div class="messageList2">
						<p>[商城回复]：${reply.content}</p>
						</div>
					#{/list}
	      		#{/if}
			#{/list}
	#{/if}
	#{else}
		暂时没有留言记录
	#{/else}
</div>

<div id="edit-comment">
	<table class="commodity-query">
		#{form @messageBoard.index(), name:'form2', id:'form2'}
			<input type="hidden" id="currentPage" name="queryBean.currentPage" value="${queryBean.currentPage}">
			每页
			<select name="queryBean.quantityEachPage" onchange="doSearch()">
				<option value="2" #{if queryBean.quantityEachPage==2} selected #{/if}>2</option>
				<option value="10" #{if queryBean.quantityEachPage==10} selected #{/if}>10</option>
				<option value="25" #{if queryBean.quantityEachPage==25} selected #{/if}>25</option>
				<option value="50" #{if queryBean.quantityEachPage==50} selected #{/if}>50</option>
			</select>
			条记录
		#{/form}
	</table>
</div>

<div id="pager"></div>

<br/>
<br/>

<div class="messageHeader">
   		您可以在这里留下对商城的意见和建议、投诉等（审核之后才会显示）
</div>
<div>
	#{form @messageBoard.commitMessage(), name:'form1', id:'form1'}
	<table width="710" height="208" cellspacing="1" border="0" bgcolor="#cccccc" 
		class="messageTable">
          <tbody>
          <tr>
            <td align="right">网名:</td>
            <td><input type="text" size="20" name="message.author" value="${editMsg.author}">
            <font class="red">*&nbsp;#{error 'message.author' /}</font>
            </td>
          </tr>
          <tr>
            <td align="right">标题:</td>
            <td><input type="text" size="20" name="message.title" value="${editMsg.title}">
            <font class="red">*&nbsp;#{error 'message.title' /}</font>
            </td>
          </tr>
		   <tr>
            	<td valign="top" align="right">内容:</td>
            	<td>
            	<textarea class="messageText" wrap="virtual" rows="4" cols="30" 
            	name="message.content">${editMsg.content}</textarea>
            	<font class="red">*&nbsp;#{error 'message.content' /}</font>
            	</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="hidden" value="act_add_message" name="act">
              <input type="submit" value="我要留言">
            </td>
          </tr>
        </tbody>
	</table>
	#{/form}              
</div>
</div>